﻿<UserControl x:Class="RauteAdministarion.Views.RauteAdministration"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:viewModels="clr-namespace:RauteAdministarion.ViewModels"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.DataContext>
        <viewModels:ViewModelRailroads/>
    </UserControl.DataContext>
    <ScrollViewer>
        <StackPanel>
        <Expander  Header="Stations">
            <StackPanel>
                <ComboBox Name="stations" ItemsSource="{Binding Stations}" 
                IsSynchronizedWithCurrentItem="True"
                DisplayMemberPath="StationName">
                   
                </ComboBox>
        <StackPanel   DataContext="{Binding SelectedStation}">
                    <Label Content="Name" Target="tbUpdateName"/>
                        <Label Content="{Binding Path=StationId}" />
                        <TextBox Name="tbUpdateName">                                
                <TextBox.Text >
                                <Binding Path="StationName"  UpdateSourceTrigger="PropertyChanged">
                    </Binding>
                </TextBox.Text>
            </TextBox>
                    <Label Content="ofset X" Target="tbUpdateOffsetX"/>
                    <TextBox Name="tbUpdateOffsetX">
                <TextBox.Text >
                                <Binding Path="OffsetX"  UpdateSourceTrigger="PropertyChanged">
                    </Binding>
                </TextBox.Text>
            </TextBox>
                    <Label Content="ofset Y" Target="tbUpdateOffsetY"/>
                    <TextBox Name="tbUpdateOffsetY">
                        <TextBox.Text >
                            <Binding Path="OffsetY"  UpdateSourceTrigger="PropertyChanged">
                            </Binding>
                        </TextBox.Text>
                    </TextBox>
                        <StackPanel Orientation="Horizontal">
                            <Button Width="100" Height="30" Content="Update" Click="Button_UpdateStation"></Button>
                            <Button Width="100" Height="30" Content="Delete" Click="Button_Click_DeleteStation"></Button>
                        </StackPanel>
                        </StackPanel>
        <Expander  Header="Add Station">
        <StackPanel>
                <Label Content="Station Name" Target="tbStationName"/>
                <TextBox Name="tbStationName">
            </TextBox>
                <Label Content="ofset X" Target="tbOfsetX"/>
                <TextBox Name="tbOfsetX"></TextBox>
                <Label Content="ofset Y" Target="tbOfsetY"/>
                <TextBox Name="tbOfsetY"></TextBox>
                <Button Content="Save" Click="Button_Click" Command="{Binding AddStation}"></Button>
            </StackPanel>   
        </Expander>
    </StackPanel>
            </Expander>
            <Expander Header="TravelTimes">
                <StackPanel>
                    <ComboBox ItemsSource="{Binding Distances}" >
                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <Label Content="{Binding Path=StartStation.StationName}" />
                                <Label Content="{Binding Path=EndStation.StationName}" />
                                <Label Content="{Binding Path=DistanceId}" />
                                    <Button Content="Delete" Click="Button_DeleteDistance"></Button>
                                </StackPanel>
                            </DataTemplate>
                        </ComboBox.ItemTemplate>


                    </ComboBox>
                </StackPanel>
            </Expander>
        
            <Expander Header="routes">
                <StackPanel>
                    
                </StackPanel>
            </Expander>
    </StackPanel>
    </ScrollViewer>
</UserControl>
